/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package mx.itschapala.com.dsw2.modelo;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author z
 */
@Entity
@Table(name = "administrador")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Administrador.findAll", query = "SELECT a FROM Administrador a"),
    @NamedQuery(name = "Administrador.findByIdAdministrador", query = "SELECT a FROM Administrador a WHERE a.administradorPK.idAdministrador = :idAdministrador"),
    @NamedQuery(name = "Administrador.findByNombre", query = "SELECT a FROM Administrador a WHERE a.nombre = :nombre"),
    @NamedQuery(name = "Administrador.findByContrase\u00f1a", query = "SELECT a FROM Administrador a WHERE a.contrase\u00f1a = :contrase\u00f1a"),
    @NamedQuery(name = "Administrador.findByInventarioidinventario", query = "SELECT a FROM Administrador a WHERE a.inventarioidinventario = :inventarioidinventario"),
    @NamedQuery(name = "Administrador.findByAdministradorcol", query = "SELECT a FROM Administrador a WHERE a.administradorcol = :administradorcol"),
    @NamedQuery(name = "Administrador.findByInventarioAlmacenidInventario", query = "SELECT a FROM Administrador a WHERE a.administradorPK.inventarioAlmacenidInventario = :inventarioAlmacenidInventario")})
public class Administrador implements Serializable {
    private static final long serialVersionUID = 1L;
    @EmbeddedId
    protected AdministradorPK administradorPK;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 45)
    @Column(name = "nombre")
    private String nombre;
    @Size(max = 45)
    @Column(name = "contrase\u00f1a")
    private String contraseña;
    @Column(name = "Inventario_idinventario")
    private Integer inventarioidinventario;
    @Size(max = 45)
    @Column(name = "Administradorcol")
    private String administradorcol;
    @JoinColumn(name = "Inventario Almacen_idInventario", referencedColumnName = "idInventario", insertable = false, updatable = false)
    @ManyToOne(optional = false)
    private InventarioAlmacen inventarioAlmacen;

    public Administrador() {
    }

    public Administrador(AdministradorPK administradorPK) {
        this.administradorPK = administradorPK;
    }

    public Administrador(AdministradorPK administradorPK, String nombre) {
        this.administradorPK = administradorPK;
        this.nombre = nombre;
    }

    public Administrador(int idAdministrador, int inventarioAlmacenidInventario) {
        this.administradorPK = new AdministradorPK(idAdministrador, inventarioAlmacenidInventario);
    }

    public AdministradorPK getAdministradorPK() {
        return administradorPK;
    }

    public void setAdministradorPK(AdministradorPK administradorPK) {
        this.administradorPK = administradorPK;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public String getContraseña() {
        return contraseña;
    }

    public void setContraseña(String contraseña) {
        this.contraseña = contraseña;
    }

    public Integer getInventarioidinventario() {
        return inventarioidinventario;
    }

    public void setInventarioidinventario(Integer inventarioidinventario) {
        this.inventarioidinventario = inventarioidinventario;
    }

    public String getAdministradorcol() {
        return administradorcol;
    }

    public void setAdministradorcol(String administradorcol) {
        this.administradorcol = administradorcol;
    }

    public InventarioAlmacen getInventarioAlmacen() {
        return inventarioAlmacen;
    }

    public void setInventarioAlmacen(InventarioAlmacen inventarioAlmacen) {
        this.inventarioAlmacen = inventarioAlmacen;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (administradorPK != null ? administradorPK.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Administrador)) {
            return false;
        }
        Administrador other = (Administrador) object;
        if ((this.administradorPK == null && other.administradorPK != null) || (this.administradorPK != null && !this.administradorPK.equals(other.administradorPK))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "mx.itschapala.com.dsw2.modelo.Administrador[ administradorPK=" + administradorPK + " ]";
    }
    
}
